package com.itheima.order.controller;

import com.itheima.common.pojo.TbOrder;
import com.itheima.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @作者 itcast
 * @创建日期 2020/10/17 14:23
 **/
@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    OrderService orderService;
    // http://ip:9001/order/itcast
    @GetMapping("/{username}")
    public List<TbOrder> findList(@PathVariable("username") String username ){
        return orderService.findOrderByUserId(username);
    }
}
